
#ifndef __PLAYER_LOGIC_H__
#define __PLAYER_LOGIC_H__

namespace nConstantFormat01
{
	struct sConstant;
}

class cLogicManager;
class cBullet;

struct sPlayerLogicDesc
{
	sPlayerLogicDesc()
	{
		logicManager = NULL;
	}

	cLogicManager* logicManager;
};

class cPlayerLogic
{
private:
	struct eEffect
	{
		enum TYPE
		{
			Long = 0,
			Speed,
			Strong,
			Broad,
			Stun,
			EOE,
		};
	};

public:
	cPlayerLogic();
	~cPlayerLogic();

	void Init(const sPlayerLogicDesc& desc);
	void Update(tFloat dt);
	void Draw();
	void Reset();

	void Shoot(const CCPoint& lastPos);

	const CCPoint& GetShootPoint() const { return m_shootPoint; }
	const CCPoint& GetPlayerPoint() const { return m_playerPos; }

	void AddEffect(eEffect::TYPE effectType);
	void RemoveEffect(eEffect::TYPE effectType);
	void LoadStone(tID entityID);

private:
	cLogicManager* m_logicManager;
	CCSprite* m_playerSprite;
	CCSprite* m_tongueSprite;
	const nConstantFormat01::sConstant* m_constantData;
	cBullet* m_stone;

	CCPoint m_playerPos;
	CCPoint m_shootDirection;
	CCPoint m_shootPoint;
	tFloat m_shootAngle;
	tFloat m_shootDistance;
	tFloat m_shootWidth;
	cTimeCounter m_shootTimer;
	tBool m_shooting;
	tBool m_stoneLoaded;

	typedef tSet<tID> tIDSet;
	tIDSet m_hitIDSet;

	cTimeCounter m_effectTimer[eEffect::EOE];
};

#endif // __PLAYER_LOGIC_H__